import random
from time import *
def Merge(L, mid, R):
    global a
    temp = []
    l = L
    r = mid + 1
    while l <= mid and r <= R:
        if a[l] <= a[r]:
            temp.append(a[l])
            l += 1
        else:
            temp.append(a[r])
            r += 1
    temp.extend(a[l:mid+1])
    temp.extend(a[r:R+1])
    for i in range(L, R+1):
        a[i] = temp[i-L]
def MergeSort(L, R):
    if L == R:
        return
    mid = (L + R) // 2
    MergeSort(L, mid)
    MergeSort(mid+1, R)
    Merge(L, mid, R)

start = time()
n = int(input())
#a = list(map(int, input().split()))
a = list(random.randint(1, 100000) for i in range(n))
MergeSort(0, n - 1)
end = time()
# print(*a)
print('time = ', end - start)